#include<iostream>
#include<string.h>
using namespace std;
char s[50]="I like c++!" ;
int IsBD(char c){
   if(c==','||c=='.'||c=='?'||c==' '||c=='!')
	 return 1; 
	 else
	 return 0;
}
int main(){
	int i=0;
	while(s[i]!='\0')
	{
		while(IsBD(s[i])==1&&s[i]!='\0')
		    i++;
		int si=i;
		while(IsBD(s[i])==0&&s[i]!='\0')
		    i++;
		    //cout<<s[i];
		int ei=i-1;
		for(int j=si;j<=(ei+si)/2;j++)
		{
			char t=s[j];
			s[j]=s[ei+si-j];
			s[ei+si-j]=t;
		}
		for(int j=si;j<=ei;j++)
		   cout<<s[j];
		cout<<endl;
		cout<<s[i];
	}
}

